// Re-made by DejaVu 

void npc(Player @player, NPC @npc) {
	int state = npc.getState();
	int job = npc.getSelected();
	if(state == 0){
		if(player.getJob() == 0){
			if(player.getLevel() >= 10){
				npc.addText("Would you like to become an Pirate?");
				npc.sendYesNo();
			}else{
				npc.addText("Come back when your at least level 10, then we can see if you can be a #bPirate#k. Arr~~!!");
				npc.sendOK();
				npc.end();
			}
		}
		else if(player.getJob() == 500 && player.getLevel() >= 30){
			npc.addText("I knew you could do it. Ready to pick your 2nd job?");
			npc.sendYesNo();
		}else{
			npc.addText("How goes your training?");
			npc.sendOK();
			npc.end();
		}
	}
	else if(state == 1){
		if(player.getJob() == 0 && player.getLevel() >= 10){
			if(npc.getSelected() == YES){
				player.setJob(500);
				npc.addText("You are now a #bPirate#k. Arr~~!!");
				player.setSp(1 + ((player.getLevel() - 10)*3));
				npc.sendOK();
				npc.end();
			} else {
				npc.end();
			}
		}
		else if(player.getJob() == 500 && player.getLevel() >= 30){
			if(npc.getSelected() == YES){
				npc.addText("Choose your path. \r\n#L510#Brawler#l\r\n#L520#Gunslinger#l");
				npc.sendSimple();
			} else {
				npc.end();
			}
		}
	}
	else if(state == 2){
		player.setJob(job);
		player.setSp(player.getSp() + 1);
		if(player.getJob() == 510){
			npc.addText("You are now a Brawler, congrats!");
		} else {
			npc.addText("You are now a Gunslinger, congrats!");
		}
		cm.sendOK();
		cm.dispose();
	} else {
		npc.addText("Come back when you are ready.");
		npc.sendOK();
		npc.end();
	}
}